import request from '@/utils/request'

// 获取权限
export function getPermission() {
  return request({
    url: '/sys/permission'
  })
}

// 新增权限
export const addPermission = (data) => request.post('/sys/permission', data)

// 删除权限
export const delPermission = (id) => request.delete(`/sys/permission/${id}`)

// 获取权限详情（数据回显）
export const getPermissionDetail = (id) => request.get(`/sys/permission/${id}`)

// 编辑权限
export const updatePermission = data => request.put(`/sys/permission/${data.id}`, data)

// 分配角色权限
export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
